<template>
	<view class="prescrip">
		<view class="add_drug_user public_sty">
			<view class="drug_box">
				<uni-icons type="plusempty" color="#999999" size="17.5"></uni-icons>
				<view class=""><text>添加用药人</text></view>
			</view>
			<view class="drug_user">
				<view class="drug_con_left">
					<view class="con_title"><text>用药人</text></view>
					<view class="con_deils">
						<text style="font-size: 36rpx;margin-right: 20rpx;">张三</text>
						<text style="font-size: 28rpx;">176****7678</text>
					</view>
				</view>
				<view class="drug_con_right"><uni-icons type="arrowright"></uni-icons></view>
			</view>
		</view>
		<view class="up_prescrip public_sty">
			<view class="up_title">
				<text>上传处方</text>
				<text class="text_sty">(最多4张)</text>
			</view>
			<view class="up_deils"><text class=".text_sty">您上传用药本人在实体医院开具的就诊凭证 （如处方单、检查报告、病例等），请勿上传无关图片</text></view>
			<view class="up_con">
				<uni-file-picker v-model="imageValue" limit="4" file-mediatype="image" :auto-upload="false" ref="files" @select="select()" @progress="progress()"></uni-file-picker>
			</view>
		</view>
		<view class="">
			<button type="primary" style="margin: 60rpx 0rpx 40rpx 0rpx;border-radius: 20rpx;" @click="upload()"><text>提交</text></button>
			<button type="default" class="delete"><text>在线问诊</text></button>
			<!-- <button type="default" @click="upphone">拉取手机相册</button>
			<button type="default" @click="up">拍照</button> -->
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			imageValue: []
		};
	},
	methods: {
		select(e) {
			console.log(e.tempFiles);
		},
		progress(e){
			console.log(e)
		},
		// 上传
		upload(){
			this.$refs.files.upload()
		},
		upphone(){
			uni.chooseImage({
			    count: 6, //默认9
			    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
			    sourceType: ['album'], //从相册选择
			    success: function (res) {
			        console.log(JSON.stringify(res.tempFilePaths),"111");
					console.log(res.tempFilePaths)
			    }
			});
		},
		up(){
			uni.authorize({
				scope:"scope.camera",
				success: (res) => {
					console.log(res)
					uni.chooseImage({
					    count: 6, //默认9
					    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					    sourceType: ['camera'], //从相册选择
					    success: function (res) {
					        console.log(JSON.stringify(res),"222");
					    }
					});
				}
			})
		
		}
	}
};
</script>

<style lang="scss" scoped>
.prescrip {
	background-color: #f9faf9;
	padding: 24rpx 30rpx 24rpx 30rpx;
	height: 100vh;
	.add_drug_user {
		margin-bottom: 24rpx;
		.drug_box {
			text-align: center;
			font-size: 28rpx;
			color: #999999;
			padding: 34rpx 30rpx;
		}
		.drug_user {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 28rpx;
			.con_title {
				color: #999999;
			}
		}
	}
	.up_prescrip {
		padding: 36rpx 24rpx;
		.up_title {
			margin-bottom: 14rpx;
		}
		.up_deils {
			padding-bottom: 32rpx;
		}
	}
	.text_sty {
		font-size: 26rpx;
		color: #999999;
		font-weight: 500;
	}
}
.delete {
	background-color: #ffffff;
	border-radius: 20rpx;
	border: none !important;
	text {
		font-size: 28rpx;
		color: #666666;
		text-align: center;
	}
}
</style>
